package com.hnit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnit.web.bean.Address;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface AddressMapper extends BaseMapper<Address> {
    List<Address> selectByUserId(@Param("userId") Long userId);

    @Update("UPDATE address SET isDefault = 0 WHERE userId = #{userId} AND isDefault = 1")
    int cancelDefaultByUserId(@Param("userId") Long userId);
}